//
//  MainViewController.swift
//  新浪微播
//
//  Created by lxw on 15/12/14.
//  Copyright © 2015年 lxw. All rights reserved.
//

import UIKit

class MainViewController: UITabBarController {
  let mainTabBar = MainTabBar()
 @objc private  func composeBtnDidClick(){
        
    }
    override func viewDidLoad() {
        super.viewDidLoad()
       // print(tabBar.classForCoder)
        
        mainTabBar.composeBtn.addTarget(self, action: "composeBtnDidClick", forControlEvents: .TouchUpInside)
        setValue(mainTabBar, forKey: "tabBar")
      //  print(tabBar.classForCoder)
         addChildViewControllers()
        
    }

    private func addChildViewControllers(){
        tabBar.tintColor = themeColor 

        addChildViewController(HomeTableViewController(),title: "首页",imageName: "tabbar_home")
        addChildViewController(MessageTableViewController(),title: "消息",imageName: "tabbar_message_center")
        addChildViewController(DiscoverTableViewController(),title: "发现",imageName: "tabbar_discover")
        addChildViewController(ProfileTableViewController(),title: "我",imageName: "tabbar_profile")
    }
    
    private func addChildViewController(vc: UIViewController,title: String,imageName: String) {
        
        let nav = UINavigationController (rootViewController: vc)
        vc.title = title
        vc.tabBarItem.image = UIImage(named: imageName)
        self.addChildViewController(nav)
    }


}
